/**
 * 列表formatter函数
 */
var FormatterJS =  {};
//模板
FormatterJS.test = function(value, row, index) {
    switch (value) {
        case 1:
            break;
        case 2:
            break;
        case 3:
            break;
        case 4:
            break;
        default:
            console.info("FormatterJS.test 使用 有误！");
            break;
    }
};

/**
 * 启用禁用
 * @param value
 * @param row
 * @param index
 * @returns {*}
 */
FormatterJS.enableDisable = function(value, row, index) {
    var retStr = '';
    switch (value){
        case 0:
            retStr =  '<span class="label label-danger">禁用</span>';
            break;
        case 1:
            retStr =  '<span class="label label-success">正常</span>';
            break;
        default:
            console.info("FormatterJS.enableDisable 使用 有误！");
            break;
    }
    return retStr;
};

FormatterJS.formateSize = function(value, row, index) {
    var fileSize = (value / 1024).toFixed(2);//保留2位小数点
    var suffix   = 'KB';
    if (fileSize > 1024) {
        //formate格式化大小 --单位为MB
        fileSize = (fileSize / 1024).toFixed(2);//保留2位小数点
        suffix   = 'MB';
    }
    return fileSize+suffix;
};

//图片
FormatterJS.preview=function(value,row,rowIndex){
    return "<a href='javascript:void(0);' style='color:blue;' onclick='PageUtils.seePic(\""+row.filePath.replace('\\','/')+"\");'>" + value + "</a>";
};

//更多按钮-课程
FormatterJS.moreOperate = function (value,row,index) {
    var btn = new StringBuffer();
    if(row.type==1){//语音PPT
        btn.append('<span class="btn label label-info" onclick="Utils.openFileGridList(\''+row.classroomid+'\');">上传PPT</span>&nbsp;&nbsp;')
    }
    btn.append('<select onchange="btnAction(this,this.options[this.options.selectedIndex].value,'+row.id+')">');
    conts.classRoom.btnArrays.forEach(function(el,index,array){
        btn.append('<option class="btn label label-success" value="'+el.val+'">');
        btn.append(el.name);
        btn.append('</option>');
    });
    btn.append('</select>');
    return btn._strs.join("");
};

//更多按钮-点播
FormatterJS.course = {};
FormatterJS.course.moreOperate = function (value,row,index) {
    var btn = new StringBuffer();
    // if(row.type==1){//语音PPT
    //     btn.append('<span class="btn label label-info" onclick="Utils.openFileGridList(\''+row.classroomid+'\');">上传PPT</span>&nbsp;&nbsp;')
    // }
    btn.append('<select onchange="btnAction(this,this.options[this.options.selectedIndex].value,'+row.id+')">');
    conts.liveXcxCourses.btnArrays.forEach(function(el,index,array){
        btn.append('<option class="btn label label-success" value="'+el.val+'">');
        btn.append(el.name);
        btn.append('</option>');
    });
    btn.append('</select>');
    return btn._strs.join("");
};

//---------------静态常量------------------------------------------------------------------------------------------

var conts =  {};
conts.yesNo = [
    {name:'否',value:0},
    {name:'是',value:1},
];

/****课程直播classRoom相关****/
conts.classRoom = {},
//课题费用类型，0为免费，1为付费，2为加密
conts.classRoom.moneyType =[
    {name:'免费',value:0},
    {name:'付费',value:1},
    {name:'加密',value:2},
];
//1为正常,0为课程结束
conts.classRoom.status =[
    {name:'正常',value:1},
    {name:'课程结束',value:0},
];
conts.classRoom.active =[
    {name:'下架',value:0},
    {name:'上架',value:1},
];

//0是语音+图文，1是语音+ppt
conts.classRoom.type =[
    {name:'语音图文',value:0},
    {name:'语音PPT',value:1},
];
conts.classRoom.btnArrays = [
    {name:'更多',val:''},
    {name:'编辑',val:'edit'},
    {name:'上架',val:'shangjia'},
    {name:'下架',val:'xiajia'},
    {name:'结束直播',val:'endLive'},
    {name:'删除',val:'delete'},
    // {name:'PPT管理',val:'ppt'},
];
/****课程直播classRoom相关****/

/****课程直播LiveXcxCourses相关****/
conts.liveXcxCourses = {};
conts.liveXcxCourses.status = [
    {name:'待上架',value:0},
    {name:'已上架',value:1},
    {name:'已下架',value:2},
    {name:'已删除',value:3},
];

conts.liveXcxCourses.btnArrays = [
    {name:'更多',val:''},
    {name:'编辑',val:'edit'},
    {name:'上架',val:'shangjia'},
    {name:'下架',val:'xiajia'},
    {name:'删除',val:'delete'},
];
/****课程直播LiveXcxCourses相关****/

